package ${package.Controller};

import com.hbsj.core.api.ApiResponseParams;
import com.hbsj.core.entity.MapResponse;
import com.hbsj.core.entity.PageResponse;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

import static com.hbsj.core.config.Constants.CURRENT;
import static com.hbsj.core.config.Constants.PAGE_SIZE;

public interface I${entity}Controller {
    @ApiOperation(value = "${table.comment}创建", notes = "${table.comment}创建")
    @ApiImplicitParams({
<#list table.fields as field>
    <#if field.name != 'id' && field.name != 'creator' && field.name != 'create_at' && field.name != 'updator' && field.name != 'update_at'>
        @ApiImplicitParam(name = "${field.propertyName}", value = "${field.comment}", required = true, dataType = "${field.propertyType}", paramType = "query", defaultValue = ""),
    </#if>
</#list>
    })
    @ApiResponseParams("{data:{\n" +
<#list table.fields as field>
            "\t\t${field.propertyName}: true,\n" +
</#list>
            "}}")
    MapResponse create(Map<String, Object> map);


    @ApiOperation(value = "${table.comment}更新", notes = "${table.comment}更新")
    @ApiImplicitParams({
<#list table.fields as field>
    <#if field.name != 'creator' && field.name != 'create_at' && field.name != 'updator' && field.name != 'update_at'>
        @ApiImplicitParam(name = "${field.propertyName}", value = "${field.comment}", required = true, dataType = "${field.propertyType}", paramType = "query", defaultValue = ""),
    </#if>
</#list>
    })
    @ApiResponseParams("{data:{\n" +
<#list table.fields as field>
            "\t\t${field.propertyName}: true,\n" +
</#list>
            "}}")
    MapResponse update(Map<String, Object> map);

    @ApiOperation(value = "${table.comment}删除", notes = "${table.comment}删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "String", paramType = "query", defaultValue = "")
    })
    MapResponse del(@RequestParam(required = false) Map<String, Object> map);

    @ApiOperation(value = "${table.comment}查询单个", notes = "${table.comment}查询单个")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "String", paramType = "query", defaultValue = "")
    })
    @ApiResponseParams("{data:{\n" +
<#list table.fields as field>
            "\t\t${field.propertyName}: true,\n" +
</#list>
            "}}")
    MapResponse get(@RequestParam(required = false) Map<String, Object> map);


    @ApiOperation(value = "${table.comment}分页查询", notes = "${table.comment}分页查询")
    @ApiImplicitParams({
<#list table.fields as field>
    <#if field.name != 'id' && field.name != 'creator' && field.name != 'create_at' && field.name != 'updator' && field.name != 'update_at'>
        @ApiImplicitParam(name = "${field.propertyName}", value = "${field.comment}", required = true, dataType = "${field.propertyType}", paramType = "query", defaultValue = ""),
    </#if>
</#list>
            @ApiImplicitParam(name = CURRENT, value = "当前页码数", required = true, dataType = "int", paramType = "query", example="1"),
            @ApiImplicitParam(name = PAGE_SIZE, value = "每页显示条数", required = true, dataType = "int", paramType = "query", example="20"),
    })
    @ApiResponseParams("{data:{\n" +
<#list table.fields as field>
            "\t\t${field.propertyName}: true,\n" +
</#list>
            "}}")
    PageResponse getPageList(Map<String, Object> map);
}
